app.controller('RtCityModalCtrl', function ($scope, $modalInstance, param,toaster) {

	$scope.submitting = false;
	$scope.param = param;
	if ($scope.param.data == null) {
		$scope.param.data = {};
	}

	$scope.list=arrCity;
	console.log($scope.list);
	for (var i = 0; i < $scope.list.length; i++) {
		if($scope.list[i].name=="其它"){
			$scope.list.splice($scope.list.indexOf($scope.list.name), 1);
		}
		if($scope.list[i].name=="海外"){
			$scope.list.splice($scope.list.indexOf($scope.list.name), 1);
		}
	}
	$scope.provinceList=$scope.list;
	$scope.provinceList.selected=$scope.provinceList[0];

	$scope.ok = function () {
		if ($scope.myForm.$valid) {
			if($scope.param.type == "insert"){
				if($scope.provinceList.selected.name=="请选择"){
					toaster.pop('warning', '提示', '请选择省份！');
					return;
				}else{
					$scope.param.data.province=$scope.provinceList.selected.name;
				}
			}else if($scope.param.type == "update"){
				if($scope.provinceList.selected.name!="请选择"){
					$scope.param.data.province=$scope.provinceList.selected.name;
				}
			}
			$modalInstance.close($scope.param);
		}
	};

	$scope.cancel = function () {
		$modalInstance.dismiss('cancel');
		$scope.submitting = false;
	};
});